data = read.csv("file:///F:/Dataset/Grade 1/TmergedCleanGrade.csv")
bn_df = data.frame(data)
sample(-3282.633:-3262.633,3)
sample(-3282.633:-3262.633,3)
sample(-3282:-3262,3)
sample(-3282.111:-3262.999,3)
sample(-3282.111:-3262.999,3)
sample(-3282.111:-3262.999,10)
sample(-3282:-3262,10)
sample(-3282:-3262,10.000)
runif(3, min = -3282.633, max = -3262.633)
runif(3, min = -5130.204, max = -5100.204)
library(bnlearn)
library(beepr)
data = read.csv("file:///F:/Dataset/Binary Case Control/BmergedCleanCaseControl.csv")
n = 25
dataCut = data[1:n]
hc_bn_df = data.frame(dataCut)
hc_bn_df[3] = lapply(hc_bn_df[3], as.numeric)
hc_bn_df[4:n] = lapply(hc_bn_df[4:n], as.factor)
#Creating Bayesian Network and timing
i = 0
while(i<10){
start_time = Sys.time()
network = hc(hc_bn_df)
end_time = Sys.time()
print(end_time - start_time)
print(score(network, hc_bn_df))
i = i+1
}
data = read.csv("file:///F:/Dataset/Binary Case Control/BmergedCleanCaseControl.csv")
data2 = read.csv("file:///F:/Dataset/Case Control 1/TmergedCleanCaseControl.csv") #Read in transposed Dataset
library(bnlearn)
library(beepr)
data = read.csv("file:///E:/Dataset/Binary Case Control/BmergedCleanCaseControl.csv")
n = 25 #How many variables will be used
dataCut = data[1:n] #Preping dataset
hc_bn_df = data.frame(dataCut) #Making Dataframe
hc_bn_df[3] = lapply(hc_bn_df[3], as.numeric) #Turning age into numeric
hc_bn_df[4:n] = lapply(hc_bn_df[4:n], as.factor) #Turning gliblastoma into 2 level factor
#Creating Bayesian Network and timing
i = 0
while(i<3){
start_time = Sys.time()
hcNetwork = hc(hc_bn_df)
end_time = Sys.time()
print(end_time - start_time)
print(score(hcNetwork, hc_bn_df)) #Prints score of network
i = i+1
}
beep(1) #Makes noise to say its done.
library(bnlearn)
library(beepr)
data = read.csv("file:///F:/Dataset/Binary Case Control/BmergedCleanCaseControl.csv")
n = 25 #How many variables will be used
data = read.csv("file:///E:/Dataset/Binary Case Control/BmergedCleanCaseControl.csv")
n = 25 #How many variables will be used
dataCut = data[1:n] #Preping dataset
mmhc_bn_df = data.frame(dataCut) #Making Dataframe
mmhc_bn_df[3] = lapply(mmhc_bn_df[3], as.numeric) #Turning age into numeric
mmhc_bn_df[4:n] = lapply(mmhc_bn_df[4:n], as.factor) #Turning gliblastoma into 2 level factor
#Creating Bayesian Network and timing
i = 0
while(i<3){
start_time = Sys.time()
mmhcNetwork = mmhc(mmhc_bn_df)
end_time = Sys.time()
print(end_time - start_time)
print(score(mmhcNetwork, mmhc_bn_df)) #Prints score of network
i = i+1
}
beep(1) #Makes noise to say its done.
library(bnlearn)
library(beepr)
data = read.csv("file:///E:/Dataset/Binary Case Control/BmergedCleanCaseControl.csv")
n = 25 #How many variables will be used
dataCut = data[1:n] #Preping dataset
gs_bn_df = data.frame(dataCut) #Making Dataframe
gs_bn_df[3] = lapply(gs_bn_df[3], as.numeric) #Turning age into numeric
gs_bn_df[4:n] = lapply(gs_bn_df[4:n], as.factor) #Turning gliblastoma into 2 level factor
#Creating Bayesian Network and timing
i = 0
while(i<3){
start_time = Sys.time()
gsNetwork = mmhc(gs_bn_df)
end_time = Sys.time()
print(end_time - start_time)
print(score(gsNetwork, gs_bn_df)) #Prints score of network
i = i+1
}
beep(1) #Makes noise to say its done.
#Creating Bayesian Network and timing
i = 0
while(i<3){
start_time = Sys.time()
gsNetwork = gs(gs_bn_df) #Creates the network
end_time = Sys.time()
print(end_time - start_time)
print(score(gsNetwork, gs_bn_df)) #Prints score of network
i = i+1
}
print(score(gsNetwork, gs_bn_df)) #Prints score of network
gsNetwork.arcs()
arcs(gsNetwork)
drop.edge(gsNetwork, "X", "gender")
arcs(gsNetwork)
gsNetwork = drop.edge(gsNetwork, "X", "gender")
arcs(gsNetwork)
print(score(gsNetwork, gs_bn_df)) #Prints score of network
#Look at Bayesian Network
print(gsNetwork)
arcs(gsNetwork)
gsNetwork = drop.edge(gsNetwork, "TFB2M", "USP2")
#Look at Bayesian Network
print(gsNetwork)
#Creating Bayesian Network and timing
i = 0
while(i<3){
start_time = Sys.time()
gsNetwork = gs(gs_bn_df) #Creates the network
end_time = Sys.time()
print(end_time - start_time)
i = i+1
}
beep(1) #Makes noise to say its done.
arcs(gsNetwork)
gsNetwork = drop.edge(gsNetwork, "X", "gender")
#Look at Bayesian Network
print(gsNetwork)
#Creating Bayesian Network and timing
i = 0
while(i<3){
start_time = Sys.time()
gsNetwork = gs(gs_bn_df, undirected = FALSE) #Creates the network
end_time = Sys.time()
print(end_time - start_time)
i = i+1
}
beep(1) #Makes noise to say its done.
arcs(gsNetwork)
#Look at Bayesian Network
print(gsNetwork)
arcs(gsNetwork)
gsNetwork = drop.edge(gsNetwork, "X", "gender")
arcs(gsNetwork)
arcs(gsNetwork)
gsNetwork = set.arc(gsNetwork, "TFB2M", "USP2")
arcs(gsNetwork)
#Look at Bayesian Network
print(gsNetwork)
print(score(gsNetwork, gs_bn_df)) #Prints score of network
n = 50 #How many variables will be used
dataCut = data[1:n] #Preping dataset
gs_bn_df = data.frame(dataCut) #Making Dataframe
gs_bn_df[3] = lapply(gs_bn_df[3], as.numeric) #Turning age into numeric
gs_bn_df[4:n] = lapply(gs_bn_df[4:n], as.factor) #Turning gliblastoma into 2 level factor
#Creating Bayesian Network and timing
i = 0
while(i<3){
start_time = Sys.time()
gsNetwork = gs(gs_bn_df, undirected = FALSE) #Creates the network
end_time = Sys.time()
print(end_time - start_time)
i = i+1
}
#Need to orient arcs
arcs(gsNetwork)
gsNetwork = drop.edge(gsNetwork, "X", "gender")
#Need to orient arcs
arcs(gsNetwork)
gsNetwork = set.arc(gsNetwork, "TFB2M", "USP2")
#Look at Bayesian Network
print(gsNetwork)
print(score(gsNetwork, gs_bn_df)) #Prints score of network
n = 100 #How many variables will be used
dataCut = data[1:n] #Preping dataset
gs_bn_df = data.frame(dataCut) #Making Dataframe
gs_bn_df[3] = lapply(gs_bn_df[3], as.numeric) #Turning age into numeric
gs_bn_df[4:n] = lapply(gs_bn_df[4:n], as.factor) #Turning gliblastoma into 2 level factor
#Creating Bayesian Network and timing
i = 0
while(i<3){
start_time = Sys.time()
gsNetwork = gs(gs_bn_df, undirected = FALSE) #Creates the network
end_time = Sys.time()
print(end_time - start_time)
i = i+1
}
#Need to orient arcs
arcs(gsNetwork)
gsNetwork = drop.edge(gsNetwork, "X", "gender")
#Need to orient arcs
arcs(gsNetwork)
gsNetwork = set.arc(gsNetwork, "TFB2M", "USP2")
print(score(gsNetwork, gs_bn_df)) #Prints score of network
n = 200 #How many variables will be used
dataCut = data[1:n] #Preping dataset
gs_bn_df = data.frame(dataCut) #Making Dataframe
gs_bn_df[3] = lapply(gs_bn_df[3], as.numeric) #Turning age into numeric
gs_bn_df[4:n] = lapply(gs_bn_df[4:n], as.factor) #Turning gliblastoma into 2 level factor
#Creating Bayesian Network and timing
i = 0
while(i<3){
start_time = Sys.time()
gsNetwork = gs(gs_bn_df, undirected = FALSE) #Creates the network
end_time = Sys.time()
print(end_time - start_time)
i = i+1
}
#Need to orient arcs
arcs(gsNetwork)
gsNetwork = drop.edge(gsNetwork, "X", "gender")
gsNetwork = set.arc(gsNetwork, "TFB2M", "USP2")
print(score(gsNetwork, gs_bn_df)) #Prints score of network
n = 400 #How many variables will be used
dataCut = data[1:n] #Preping dataset
gs_bn_df = data.frame(dataCut) #Making Dataframe
gs_bn_df[3] = lapply(gs_bn_df[3], as.numeric) #Turning age into numeric
gs_bn_df[4:n] = lapply(gs_bn_df[4:n], as.factor) #Turning gliblastoma into 2 level factor
#Creating Bayesian Network and timing
i = 0
while(i<3){
start_time = Sys.time()
gsNetwork = gs(gs_bn_df, undirected = FALSE) #Creates the network
end_time = Sys.time()
print(end_time - start_time)
i = i+1
}
#Need to orient arcs
arcs(gsNetwork)
gsNetwork = drop.edge(gsNetwork, "X", "gender")
#Need to orient arcs
arcs(gsNetwork)
gsNetwork = set.arc(gsNetwork, "TFB2M", "USP2")
#Need to orient arcs
arcs(gsNetwork)
gsNetwork = set.arc(gsNetwork, "NR3C1", "NR3C1.1")
#Need to orient arcs
arcs(gsNetwork)
print(score(gsNetwork, gs_bn_df)) #Prints score of network
gsNetwork = set.arc(gsNetwork, "PLD1", "ICMT")
print(score(gsNetwork, gs_bn_df)) #Prints score of network
n = 800 #How many variables will be used
dataCut = data[1:n] #Preping dataset
gs_bn_df = data.frame(dataCut) #Making Dataframe
gs_bn_df[3] = lapply(gs_bn_df[3], as.numeric) #Turning age into numeric
gs_bn_df[4:n] = lapply(gs_bn_df[4:n], as.factor) #Turning gliblastoma into 2 level factor
#Creating Bayesian Network and timing
i = 0
while(i<3){
start_time = Sys.time()
gsNetwork = gs(gs_bn_df, undirected = FALSE) #Creates the network
end_time = Sys.time()
print(end_time - start_time)
i = i+1
}
#Need to orient arcs
arcs(gsNetwork)
gsNetwork = drop.edge(gsNetwork, "X", "gender")
#Need to orient arcs
arcs(gsNetwork)
gsNetwork = set.arc(gsNetwork, "TFB2M", "USP2")
gsNetwork = set.arc(gsNetwork, "PLD1", "ICMT")
#Need to orient arcs
arcs(gsNetwork)
gsNetwork = set.arc(gsNetwork, "NR3C1", "NR3C1.1")
print(score(gsNetwork, gs_bn_df)) #Prints score of network
n = 1600 #How many variables will be used
dataCut = data[1:n] #Preping dataset
gs_bn_df = data.frame(dataCut) #Making Dataframe
gs_bn_df[3] = lapply(gs_bn_df[3], as.numeric) #Turning age into numeric
gs_bn_df[4:n] = lapply(gs_bn_df[4:n], as.factor) #Turning gliblastoma into 2 level factor
#Creating Bayesian Network and timing
i = 0
while(i<3){
start_time = Sys.time()
gsNetwork = gs(gs_bn_df, undirected = FALSE) #Creates the network
end_time = Sys.time()
print(end_time - start_time)
i = i+1
}
#Need to orient arcs
arcs(gsNetwork)
gsNetwork = drop.edge(gsNetwork, "X", "gender")
#Need to orient arcs
arcs(gsNetwork)
gsNetwork = set.arc(gsNetwork, "TFB2M", "USP2")
gsNetwork = set.arc(gsNetwork, "PLD1", "ICMT")
gsNetwork = set.arc(gsNetwork, "NR3C1", "NR3C1.1")
#Need to orient arcs
arcs(gsNetwork)
gsNetwork = set.arc(gsNetwork, "HFE", "HFE.1")
gsNetwork = set.arc(gsNetwork, "JUND", "JUND.1")
gsNetwork = set.arc(gsNetwork, "CEACAM1", "CEACAM.1")
#Need to orient arcs
arcs(gsNetwork)
gsNetwork = set.arc(gsNetwork, "CEACAM1", "CEACAM1.1")
#Need to orient arcs
arcs(gsNetwork)
print(score(gsNetwork, gs_bn_df)) #Prints score of network
